home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1997 November & December / Amiga-CD 1997 #11-12.iso / pd-disketten / dms-gepackt / 8_95 / apd-8-95-2.dms / apd-8-95-2.adf / Psion / Developer / Source / ncplib / openncp.c.bak < prev    next >
Text File  |  1986-10-26  |  1KB  |  62 lines

  1. /*
  2. **    SAS/C 6.51 constructor for opening
  3. **  "ncp.library"
  4. **/
  5.  
  6. #include <constructor.h>
  7. #define __USE_SYSBASE
  8. #include <proto/exec.h> 
  9. #include <exec/execbase.h>
  10. #include <proto/intuition.h>
  11. #include <proto/dos.h>
  12. #include <libraries/ncplib.h>
  13. #include <string.h>
  14. struct Library *NCPBase;
  15. static struct Library *libbase;
  16.  
  17. CONSTRUCTOR_P(ncplib,500)
  18. {
  19.     struct EasyStruct eas;
  20.     char buffer[ 128 ];
  21.     struct Task *pr = FindTask( NULL );
  22.  
  23.     if( SysBase->LibNode.lib_Version < 37 )
  24.         return( 1 );
  25.  
  26.     FOREVER
  27.     {
  28.         libbase = OpenLibrary( NCP_NAME, NCP_VERSION );
  29.         if( !libbase )
  30.             libbase = OpenLibrary( "PROGDIR:" NCP_NAME, NCP_VERSION );
  31.         if( !libbase )
  32.             libbase = OpenLibrary( "PROGDIR:Libs/" NCP_NAME, NCP_VERSION );
  33.         if( libbase )
  34.         {
  35.             NCPBase = libbase;
  36.             return( 0 );
  37.         }
  38.  
  39.         eas.es_StructSize = sizeof( eas );
  40.         eas.es_Flags = 0;
  41.         eas.es_Title = buffer;
  42.         strncpy( buffer, pr->tc_Node.ln_Name, 127 );
  43.         if( Cli() )
  44.             GetProgramName( buffer, 127 );
  45.         buffer[ 127 ] = 0;
  46.         eas.es_TextFormat = "Requires V%ld (or higher))\nof \"" NCP_NAME "\"";
  47.         eas.es_GadgetFormat = "Retry|Cancel";
  48.         if( !EasyRequest( NULL, &eas, NULL, NCP_VERSION ) )
  49.             return( 1 );
  50.  
  51.    }
  52. }
  53.  
  54. DESTRUCTOR_P(ncplib,500)
  55. {
  56.    if (libbase)
  57.    {
  58.       CloseLibrary((struct Library *)libbase);
  59.       libbase = NCPBase = NULL;
  60.    }
  61. }
  62.